<ui:composition xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:fn="http://java.sun.com/jsp/jstl/functions"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets" template="/home.xhtml">
	<ui:define name="corpo">
		<h:form prependId="false">
			<p:panel header="Área do Paciente" style="background: #dbfbda;font-size:15px;min-height:700px;margin-top:10px;float:left;width:99%">
				<h:panelGroup style="float: left;width:250px;" layout="block">
					<ui:include src="menu_esquerda.xhtml" />	
				</h:panelGroup>
				
				<h:panelGroup layout="block" style="float:left">
					<p:panel header="Buscar consultas" style="width:680px">
						<h:panelGroup layout="block">
							<h:panelGrid columns="5" cellpadding="2" cellspacing="2">
								<h:outputLabel value="Data inicial: " for="dataInicial" />
								<p:calendar id="dataInicial" value="#{marcacaoConsultaPacienteBean.form.dataInicio}" pattern="dd/MM/yyyy" locale="pt_BR" timeZone="GMT-3" />
																
								<h:outputLabel value="Data final: " for="dataFinal" />
								<p:calendar id="dataFinal" value="#{marcacaoConsultaPacienteBean.form.dataFim}" pattern="dd/MM/yyyy" locale="pt_BR" timeZone="GMT-3" />
								
								<p:commandButton value="Listar consultas" update="msgDataInicial,tabelaConsultasMarcadas,msg" action="#{marcacaoConsultaPacienteBean.listarConsultasMarcadas}" />
								
								<h:outputText />
								<h:messages layout="table" styleClass="msg_erro_required" id="msg" />
								
							</h:panelGrid>
							<p:spacer height="15" />
							<h:panelGroup layout="block">
								<p:dataTable id="tabelaConsultasMarcadas" value="#{marcacaoConsultaPacienteBean.form.consultasDoPaciente}" selectionMode="single" var="entity" paginator="true" rows="10" emptyMessage="Nenhuma consulta disponível"
							                 paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}" 
							                 paginatorPosition="bottom">
							    	<f:facet name="header">
							    		<h:panelGroup layout="block" style="text-align:left">
							    			<h:outputText value="Minhas Consultas" />
							    		</h:panelGroup>							    		
							    	</f:facet>
							    	
								    <p:column>

										<h:panelGroup layout="block" style="width:500px;">
	
											<h:panelGroup style="float:left">
												<h:outputText value="#{entity.medico.nome}" style="font-size:14px;font-weight:bold;color:#656765" />
												<br />
												<h:outputText value="CRM: " styleClass="fmtCampoConsulta"/>
												<h:outputText value="#{entity.medico.crm}" />
												<br />
												<h:outputText value="E-mail: " styleClass="fmtCampoConsulta" />
												<h:outputText value="#{entity.medico.email}" style="font-style: italic;" />
											</h:panelGroup>
											
											<h:panelGroup style="float:right">
												<h:outputText value="Data da consulta: " styleClass="fmtCampoConsulta" />
												<h:outputText value="#{entity.dataConsulta}">
													<f:convertDateTime pattern="dd/MM/yyyy" locale="pt_BR" timeZone="GMT-3" />
												</h:outputText>
												<br />
												<h:outputText value="Horário: " styleClass="fmtCampoConsulta" />
												<h:outputText value="#{entity.dataConsulta}">
													<f:convertDateTime pattern="HH:mm" locale="pt_BR" timeZone="GMT-3" />
												</h:outputText>
												<br />
												<h:outputText rendered="#{entity.flagAtendido eq 'N'}" value="Consulta em aberto" style="color:#41B43C;font-weight:bolder" />
												
											</h:panelGroup>
											
										</h:panelGroup>
									</p:column>
							    	
							    	             
				                </p:dataTable>
							</h:panelGroup>
						</h:panelGroup>
					</p:panel>
				</h:panelGroup>
			</p:panel>
		</h:form>
	</ui:define>
</ui:composition>